OutcomeReceiverCompat

Callback interface intended for use when an asynchronous operation may result in a failure. This interface may be used in cases where an asynchronous API may complete either with a value or with a Throwable that indicates an error.

Parameters

<R>

The type of the result that's being sent.

<E>

The type of the Throwable that contains more information about the error. This interface serves the same purpose as android.os.OutcomeReceiver, but can be used on API versions before 31.

Functions

Link copied to clipboard
open fun onError(@NonNull error: E)
Called when the asynchronous operation fails.
Link copied to clipboard
abstract fun onResult(result: R)
Called when the asynchronous operation succeeds and delivers a result value.